package cn.mrcode.fd.blog.controller;

import cn.mrcode.fd.blog.cache.service.IArticleCache;
import cn.mrcode.fd.blog.common.BaseController;
import cn.mrcode.fd.blog.services.IArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 开发测试填充数据
 * @author : zhuqiang
 * @version : V1.0
 * @date : 2016/3/13 16:16
 */


@Controller
@RequestMapping("/test")
public class TestController extends BaseController {

    @Autowired
    private IArticleService iArticleService;
    @Autowired
    private IArticleCache iArticleCache;

//    @RequestMapping(value = "/article/add/{num}", produces = "application/json;charset=utf-8")
//    @ResponseBody
//    public String article_add(@PathVariable int num, RedirectAttributes attributes) throws Exception {
//
//        User user = getUser();
//        for (int i = 0; i < num; i++) {
//            ArticleCu articleCu = new ArticleCu();
//            String titleRandom = RandomStringUtils.random(5, true, true);
//            String bodyRandom = RandomStringUtils.random(200, true, true);
//            articleCu.setBody("[TOCM]\n" +
//                    "\n" +
//                    ":bowtie: hello,mrcode blog!\n" +
//                    "清风吹来气象新——从四个侧面看两会会风" + bodyRandom);
//            articleCu.setTitle("清风吹来气象新--" + titleRandom);
//            articleCu.setSummary("清风吹来气象新——从四个侧面看两会会风");
//            articleCu.setTagNames("测试");
//            articleCu.setCategoryNames("测试");
//            String articleId = iArticleService.insert(articleCu, user);
//        }
//        return "ok";
//    }
//
//    @RequestMapping(value = "/redis_incr", produces = "application/json;charset=utf-8")
//    @ResponseBody
//    public String redis_incr() {
//        Long testincr = iArticleCache.getIncrId("testincr");
//        return testincr.toString();
//    }
    @RequestMapping("/test")
    public String test(){
        return "/test";
    }
}
